<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/plugins/ckeditor/ckeditor.js', CClientScript::POS_HEAD);
$this->breadcrumbs = array(
    'Actors' => array('index'),
    $model->id => array('view', 'id' => $model->id),
    'Update',
);

$this->menu = array(
    array('label' => 'List Actor', 'url' => array('index')),
    array('label' => 'Create Actor', 'url' => array('create')),
    array('label' => 'View Actor', 'url' => array('view', 'id' => $model->id)),
    array('label' => 'Manage Actor', 'url' => array('admin')),
);
?>

<h1>Chỉnh sửa diễn viên <?php echo $model->name_vn; ?></h1>

<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'actor-form',
    'enableAjaxValidation' => TRUE,
        ));
?>


<?php echo $form->errorSummary($model); ?>

<?php echo $form->textFieldRow($model, 'name_vn', array('class' => 'span5', 'maxlength' => 100)); ?>

<?php echo $form->textFieldRow($model, 'name_en', array('class' => 'span5', 'maxlength' => 100)); ?>

<?php echo $form->textFieldRow($model, 'link', array('class' => 'span5', 'maxlength' => 100)); ?>

<?php echo $form->textFieldRow($model, 'avatar', array('class' => 'span5', 'maxlength' => 100)); ?>

<?php echo $form->textAreaRow($model, 'about', array('rows' => 6, 'cols' => 50)); ?>

<?php echo $form->dropDownListRow($model, 'status', array(1 => 'Hiện', 0 => 'Ẩn')); ?>


<div class="form-actions">
<?php
$this->widget('bootstrap.widgets.TbButton', array(
    'buttonType' => 'submit',
    'type' => 'primary',
    'label' => $model->isNewRecord ? 'Create' : 'Save',
));
?>
</div>

<?php $this->endWidget(); ?>
<script type="text/javascript">
    var editor = CKEDITOR.replace('Actor[about]', {
        skin: 'moono',
        toolbar: [
            {name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike']},
            {name: 'aligh', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
            {name: 'basicstyles1', items: ['Subscript', 'Superscript']},
            {name: 'paragraph', items: ['NumberedList', 'BulletedList']},
            {name: 'paragraph', items: ['Outdent', 'Indent', '-', 'Blockquote']},
            {name: 'links', items: ['Link', 'Unlink']},
            {name: 'document', items: ['Source']},
            '/',
            {name: 'styles', items: ['Font', 'FontSize']},
            {name: 'colors', items: ['TextColor', 'BGColor']},
            {name: 'insert', items: ['Iframe', 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar']},
            {name: 'editing', items: ['Find', 'Replace', 'RemoveFormat']},
            {name: 'tools', items: ['Maximize', 'ShowBlocks']}
        ]
    });
    CKEDITOR.config.removeFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';
    CKEDITOR.on('instanceReady', function(e) {
        var editor = e.editor;
        editor.on('paste', function(e) {
            setTimeout(function() {
                editor.focus();
                editor.document.$.execCommand('SelectAll', false, null);
                editor.execCommand('removeFormat', editor.selection);
            }, 0);
        });
    });

</script>